<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
Route::get('/init','IndexController@init');
Route::get('/loans','LoanController@index');
Route::get('/loan/{id}','LoanController@detail');
Route::get('/search','SearchController@index');
Route::post('/advice','AdviceController@postAdd');

Route::get('/applys','ApplyController@index');
Route::post('/apply','ApplyController@postAdd');


Route::group(['prefix' => 'user'], function () {
    Route::post('/','UserController@postAdd');//注册用户
    Route::post('/login','UserController@login');//登陆
    Route::get('/code','UserController@code');//发送验证码
    Route::get('/{id}','UserController@detail');//发送验证码
    Route::post('/{id}','UserController@edit');//编辑用户
    Route::post('/login/code','UserController@codeLogin');//验证码登陆
    Route::post('/password','UserController@editPassword');//编辑用户密码
    
});

Route::get('/banners','BannerController@index');
